/**
 * Description:
 * Class Name:Circle
 * Date:2022/1/30 9:53
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第6章_面向对象_下._6_5_抽象类;

public class Circle extends Shape{
    private double radius;
    public Circle(String color, double radius){
        super(color);
        this.radius = radius;
    }
    public void setRadius(double radius){
        this.radius = radius;
    }

    // 重写Shape类的计算周长的抽象方法————圆形
    public double calPerimeter(){
        return 2 * Math.PI * radius;
    }
    // 重写Shape类的返回形状的抽象方法
    public String getType(){
        return getColor() + "圆形";
    }

    public static void main(String[] args) {
        Shape s1 = new Triangle("黑色", 3, 4, 5);
        Shape s2 = new Circle("黄色", 3);
        System.out.println(s1.getType());
        System.out.println(s1.calPerimeter());
        System.out.println(s2.getType());
        System.out.println(s2.calPerimeter());
    }
}
